<?php

/**
 * Rozsireni parseru muzes pouzivat i globalni promeny parseru.
 *
 * @author hodek
 */
class DynstrucImp extends DynstrucAbstract {

    //put your code here
    public static function exctractDyn($idcismap) {
        if (getCurrentCat() == "banner") {
            $result = selectDyncismap($idcismap);
            $temp = "";
            $counter = mysql_num_rows($result);
            while ($row = mysql_fetch_array($result)) {
                if (getCurrentItemTypeName() == "bannerBig") {
                    $temp .= ' data-image' . $counter . '="Image.php?size=full&id=' . $row["fkname"] . '"';
                }
                if (getCurrentItemTypeName() == "smallBig") {
                    $temp .= ' data-small' . $counter . '="Image.php?size=full&id=' . $row["fkname"] . '"';
                }
                $counter--;
            }
            return $temp;
        }
        $result = selectDyncismap($idcismap);
        $temp = "";
        if (mysql_num_rows($result) > 0) {
            $temp = parse(loadTemplate(null, "clanekRozbalDynFirst"));
            while ($row = mysql_fetch_array($result)) {
                $temp .= '<a href="Image.php?size=full&id=' . $row["fkname"] . '" target="blank" ><img src="Image.php?size=medium&id=' . $row["fkname"] . '" alt="" class="imageLeftRightMargin"/></a>';
            }
            $temp .= parse(loadTemplate(null, "clanekRozbalDynSecond"));
        }
        return $temp;
    }

    public static function DBselectItems($itemType_name) {
        if ($itemType_name == "blog") {
            $query = sprintf(SQL::$SELECT_BLOG_SORTED);
            return mq($query, getCon());
        }
        if ($itemType_name == "games") {
            $query = sprintf(SQL::$SELECT_GAMES_SORTED);
            return mq($query, getCon());
        }
        return null;
    }

}

?>
